home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_5.lha
/
5_5
/
5_5a4.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
781b
|
31 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
tatic tree* term(istream& input)
tree* left = prim(input);
for (;;)
switch (curr_tok.type)
{
case MUL:
case DIV:
f (debug) cout << "term() sees +/-\n"; // DELETE
f (debug) { cout << "term():left:\n"; left->print(0); } // DELETE
tree* head = new tree;
head->type = curr_tok.type;
head->left = left;
get_token(input); // eat '*','/'
head->right = prim(input);
left = head;
f (debug) { cout << "term():new left:\n"; left->print(0); } // DELETE
break;
default: // collapse node
f (debug) cout << "term() sees other\n"; // DELETE
f (debug) { cout << "left:\n"; left->print(0); } // DELETE
return left;
}